package com.nengchuan.eic.nceconomy.entity.vo;

import com.eic.review.sdk.vo.TechnoProjectInfoVo;
import com.eic.review.sdk.vo.TechnoProjectVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 功能描述:
 *
 * @Author: liurui
 * @Date: 2020/5/19 0019 下午 2:18
 */
@Data
@NoArgsConstructor
public class OrgProject {
    @ApiModelProperty(value = "父工程id")
    private Long pid;
    @ApiModelProperty(value = "项目id")
    private Long projectId;

    @ApiModelProperty(value = "项目名称")
    private String projectName;

    @ApiModelProperty(value = "erp编号")
    private String erpNumber;

    @ApiModelProperty(value = "电压等级(千伏)")
    private String voltageGrade;

    @ApiModelProperty(value = "项目阶段")
    private String projectStage;

    @ApiModelProperty(value = "技经专责")
    private List<DutyVO> roleNceconomyDuty;

    @ApiModelProperty(value = "技术专责")
    private List<DutyVO> roleTechnologyDuty;



    @ApiModelProperty(value = "项目类型")
    private Integer projectType;

    @ApiModelProperty(value = "子工程集合")
    private List<OrgProject> projectLists;

    public OrgProject(TechnoProjectVO vo){
        this.projectId=vo.getProjectId();
        this.projectName=vo.getProjectName();
        this.erpNumber=vo.getErpNumber();
        this.voltageGrade=vo.getVoltageGrade();
        this.projectStage=vo.getProjectStage();
        this.projectType=vo.getProjectType();
        if(CollectionUtils.isNotEmpty(vo.getRvProjectBaseList())){
            List<OrgProject> projectList=new ArrayList<>();
            vo.getRvProjectBaseList().forEach(x->{
                OrgProject orgProject = new OrgProject();
                orgProject.setProjectId(x.getProjectId());
                orgProject.setProjectName(x.getProjectName());
                orgProject.setErpNumber(x.getErpNumber());
                orgProject.setVoltageGrade(x.getVoltageGrade());
                orgProject.setProjectStage(x.getProjectStage());
                orgProject.setProjectType(x.getProjectType());
                orgProject.setPid(x.getPid());
                projectList.add(orgProject);
            });
            this.setProjectLists(projectList);
        }




    }



}
